﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Money_Dance
{
    public partial class MoneyDance : Form
    {
/// <summary>
/// PasCal MyEmployee VuongDong class method property.
/// caMel vuongDong varible parameter.
/// </summary>
       
        UserControlTrangchu TrangChu = new UserControlTrangchu();
        UserControlCheckingAccount Checking = new UserControlCheckingAccount();
        UserControlSavingAccount Saving = new UserControlSavingAccount();
        UserControlBieudo BieuDo = new UserControlBieudo();
        UserControlBaoCao Baocao = new UserControlBaoCao();
        UserControlTransactionRemider Reminder = new UserControlTransactionRemider();
        UserControlTransactionRemiderSaving RemidSaving = new UserControlTransactionRemiderSaving();
       // UserControlCategoryGroup Category = new UserControlCategoryGroup();
       
        public static string TypeAccount ;
        public static int IdUser = 0;

        public MoneyDance()
        {
            InitializeComponent();
        }

        public MoneyDance(int ID)
        {
            IdUser = ID;
        }

        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string AccountType;
            this.PanelTimkiem.Visible = true;
            switch (e.Node.Text)
            {                  
                case "Trang chủ":                    
                    if (splitContainer1.Panel2.Controls.Count > 0)
                    {
                        this.splitContainer1.Panel2.Controls.Clear();
                     
                    }
                    this.splitContainer1.Panel2.Controls.Add(TrangChu);
                    break;
                case "Lịch nhắc nhở":
                    if (splitContainer1.Panel2.Controls.Count > 0)
                    {
                        this.splitContainer1.Panel2.Controls.Clear();
                    }
                    string Te = "Saving";
                    UserControlTransactionRemiderSaving TransRemider1 = new UserControlTransactionRemiderSaving(Te, IdUser);
                    this.splitContainer1.Panel2.Controls.Add(RemidSaving);
                    break;

                case "TK Thu chi":
                    if (splitContainer1.Panel2.Controls.Count > 0)
                    {                        
                        this.splitContainer1.Panel2.Controls.Clear();     
                    }
                    AccountType = "Checking";
                    UserControlCheckingAccount Tkchi = new UserControlCheckingAccount(AccountType, IdUser);
                    this.splitContainer1.Panel2.Controls.Add(Checking);                   
                    break;

                case "TK Tiết kiệm":
                    if (splitContainer1.Panel2.Controls.Count > 0)
                    {
                        this.splitContainer1.Panel2.Controls.Clear();
                    }
                    AccountType = "Saving";
                    UserControlSavingAccount saving = new UserControlSavingAccount(AccountType, IdUser);
                    this.splitContainer1.Panel2.Controls.Add(Saving);                     
                    break;
                case "Biểu đồ":                   
                   if (splitContainer1.Panel2.Controls.Count > 0)
                   {
                       this.splitContainer1.Panel2.Controls.Clear();
                   }
                   UserControlBieudo bieudo = new UserControlBieudo(IdUser);
                   splitContainer1.Panel2.Controls.Add(BieuDo);
                    break;
                case "Báo cáo":
                    if (splitContainer1.Panel2.Controls.Count > 0)
                    {
                        this.splitContainer1.Panel2.Controls.Clear();
                    }
                    UserControlBaoCao Report = new UserControlBaoCao();
                    this.splitContainer1.Panel2.Controls.Add(Baocao);

                    break;

            }
        }
             
        private void Money_Dance_Load(object sender, EventArgs e)
        {
            ImageList il = new ImageList();

            this.splitContainer1.Panel2.Controls.Add(TrangChu);
            il.Images.Add(new Icon("home.ico"));
            il.Images.Add(new Icon("calender.ico"));
            il.Images.Add(new Icon("sign_down.ico"));
            il.Images.Add(new Icon("saving.ico"));
            il.Images.Add(new Icon("checking.ico"));
            il.Images.Add(new Icon("sign_out.ico"));
            il.Images.Add(new Icon("pie_chart.ico"));
            il.Images.Add(new Icon("report.ico"));

            TreeViewMain.ImageList = il;
            TreeNode homepage = TreeViewMain.Nodes.Add("Trang chủ", "Trang chủ", 0,0);
            TreeNode remindSaving = TreeViewMain.Nodes.Add("Lịch nhắc nhở", "Lịch nhắc nhở", 1, 1);
            TreeNode rootnode = TreeViewMain.Nodes.Add("Tài khoản", "Tài khoản", 2,2);
            TreeNode check = rootnode.Nodes.Add("TK Thu chi", "TK Thu chi", 3,3);
            TreeNode save = rootnode.Nodes.Add("TK Tiết kiệm", "TK Tiết kiệm", 4,4);
            TreeNode graph = TreeViewMain.Nodes.Add("Biểu đồ & Báo cáo", "Biểu đồ & Báo cáo", 2,2);
            TreeNode bieudo = graph.Nodes.Add("Biểu đồ", "Biểu đồ", 6,6);
            TreeNode baocao = graph.Nodes.Add("Báo cáo", "Báo cáo", 7,7);
        }

        

      
      
    }
}
